/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entidade;

import java.util.Enumeration;
import java.util.Vector;

/**
 *
 * @author Victorino
 */
public class MObjectKeySort {

    public static final int STRING = 0;
    public static final int INTEGER = 1;
    public static final int VECTOR = 2;
    public static final int BOOLEAN = 3;
    public static final int DATE = 4;

    public static Vector Ordenate(int size, Enumeration en) {

      /*  int[] pri = new int[size];
        MObjectKey[] keys = new MObjectKey[size];
        for (int i = 0; i < size; i++) {
            keys[i] = ((MObjectKey) en.nextElement());
            pri[i] = keys[i].priorit;
        }

        bubbleSort(pri);

        Vector vec = new Vector(pri.length);

        for (int i = 0; i < pri.length; i++) {
            int j = pri[i];
            for (int k = 0; k < keys.length; k++) {
                MObjectKey key = keys[k];
                if (key.priorit == j) {
                    vec.addElement(key);
                }
            }
        }
        pri = null;
        vec.trimToSize();
        return vec;
       * */
        return null;
    }

    public static void bubbleSort(int[] a) {
        for (int i = 0; i < a.length - 1; i++) {
            for (int j = 0; j < a.length - i - 1; j++) {
                if (a[j] > a[j + 1]) {
                    swap(a, j, j + 1);
                }
            }
        }
    }

    private static void swap(int[] a, int i, int j) {
        int temp = a[i];
        a[i] = a[j];
        a[j] = temp;
    }
}
